#include "stdafx.h"
#include "Logger.h"

namespace GraphCutLib
{
	Logger*	Logger::ms_Singleton = NULL;

	Logger::Logger(void)
	{
		std::string fileName="log.txt";
		m_stream.open(fileName.c_str(),std::ios::in | std::ios::out | std::ios::trunc /*| std::ios::binary*/);
		if(m_stream.fail())
			int ii = 0;
	}

	Logger::~Logger(void)
	{
		m_stream.close();
	}

	Logger* Logger::getInstance()
	{
		return ms_Singleton;
	}

	void Logger::reset(const std::string &fileName)
	{
		//#if OGRE_THREAD_SUPPORT
		//	OGRE_LOCK_MUTEX(m_mutex);
		//#endif

		//m_stream.open(fileName.c_str(),std::ios::in | std::ios::out | std::ios::trunc | std::ios::binary);
		//m_stream.close();
	}

	void Logger::init(const std::string &fileName)
	{
		//m_stream.open(fileName.c_str(),std::ios::in | std::ios::out | std::ios::app | std::ios::binary);
	}

	void Logger::clear()
	{
		//m_stream.close();
	}

	void Logger::log(const std::string &info)
	{

		m_stream<<info.c_str() << std::endl;
	}
}